<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

        // 面向对象

        function Father(postion,type) {
            // 普通函数会对外暴露属性
            this.posone=postion;
            this.typeone=type;
        }
    //构造函数原型上写逻辑方法
    Father.prototype.setPostion = function () {
        if (this.postion1 == "left") {
          //左边显示逻辑
          console.log('left', this.postion1);
  
        }
        //右边显示逻辑
        if (this.postion1 == "right") {
          console.log('right', this.postion1);
        }
      }
  
      Father.prototype.setStyle = function () {
  
        if (this.type1 == "border") {
          console.log('边框样式', this.type1);
        }
      }
  
      //用户在外面使用的时候,通过new 实例化，传入对应的属性
      let f1 = new Father('right', 'border')
      f1.setPostion()
      f1.setStyle() 
    </script>
</body>
</html>